package com.ywb;

/**
 * @Author ywb
 */
public class test {
    public static void main(String[] args) {
        int[] nums = {1,2,3,4,5,6,7,8,9};
        int target = 5;
        int[] result = findIndex2Target(nums, target);
        System.out.println(result[0] + ", " + result[1]);

        String join = String.join(",", "yaowenbin", "ywb");


    }
    public static int[] findIndex2Target(int[] nums, int target){
        int[] temp = new int[2];
        for (int i = 1; i < nums.length; i++) {
            if(nums[i] + nums[i-1] == target){
                temp[0] = i - 1;
                temp[1] = i;
            }
        }
        return temp;


    }

}
